package leetcode_161_180;

import leetcode_141_160.preorderTraversal_144;
import org.junit.Test;
import utils.TreeNode;

import java.util.Arrays;

public class Test9 {
    @Test
    //寻找峰值
    public void test162() {
        int [] nums={1,2,3,1};
        System.out.println(new findPeakElement_162().findPeakElement(nums));
    }

    @Test
    //最大间距
    public void test164() {
        int [] nums={3,6,9,1};
        System.out.println(new maximumGap_164().maximumGap(nums));
    }

    @Test
    //比较版本号
    public void test165() {
        String version1 = "1.0.1", version2 = "1";
        System.out.println(new compareVersion_165().compareVersion(version1,version2));
    }

    @Test
    //比较版本号
    public void test166() {
        int numerator =420, denominator =226;
        System.out.println(new fractionToDecimal_166().fractionToDecimal(numerator,denominator));
    }

    @Test
    //两数之和 II - 输入有序数组
    public void test167() {
        int [] nums={5,25,75};
        System.out.println(Arrays.toString(new twoSum_167().twoSum(nums, 100)));
    }


    @Test
    //Excel表列名称
    public void test168() {
        System.out.println(new convertToTitle_168().convertToTitle2(701));
    }

    @Test
    //多数元素
    public void test169() {
        int [] nums={5,25,75};
        System.out.println(new majorityElement_169().majorityElement(nums));
    }

    @Test
    //Excel 表列序号
    public void test171() {
        System.out.println(new titleToNumber_171().titleToNumber("AZ"));
    }

    @Test
    //阶乘后的零
    public void test172() {
        System.out.println(new trailingZeroes_172().trailingZeroes(13));
    }

    @Test
    //二叉树的前序遍历
    public void test144() {
        TreeNode treeNode1=new TreeNode(7);
        TreeNode treeNode2=new TreeNode(3);
        TreeNode treeNode3=new TreeNode(15);
        TreeNode treeNode6=new TreeNode(9);
        TreeNode treeNode7=new TreeNode(20);

        treeNode1.left=treeNode2;
        treeNode1.right=treeNode3;

        treeNode3.left=treeNode6;
        treeNode3.right=treeNode7;

        BSTIterator bSTIterator = new BSTIterator(treeNode1);
        bSTIterator.next();    // 返回 3
        bSTIterator.next();    // 返回 7
        bSTIterator.hasNext(); // 返回 True
        bSTIterator.next();    // 返回 9
        bSTIterator.hasNext(); // 返回 True
        bSTIterator.next();    // 返回 15
        bSTIterator.hasNext(); // 返回 True
        bSTIterator.next();    // 返回 20
        bSTIterator.hasNext(); // 返回 False
    }

    @Test
    //多数元素
    public void test174() {
        int [][] nums={{-2,-3,3},{-5,-10,1},{10,30,-5}};
        System.out.println(new calculateMinimumHP_174().calculateMinimumHP(nums));
    }

    @Test
    //最大数
    public void test179() {
        int[] nums={1,2,3,4,5,6,7,8,9,0};
        System.out.println(new largestNumber_179().largestNumber2(nums));
    }
}
